﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ScreenMonitor.ServerLib
{
    /// <summary>
    /// 表示客户端命令中心
    /// </summary>
    public static class ClientCommandCenter
    {

        /// <summary>
        /// 暂停发送屏幕图像
        /// </summary>
        /// <param name="Clients">要设定的客户端对象集合</param>
        public static void PauseSendBmp(List<ClientObject> Clients)
        {
            foreach(ClientObject client in Clients)
            {
                client.IsPausedSendImg = true;
            }
        }

        /// <summary>
        /// 开始发送屏幕图像
        /// </summary>
        /// <param name="Clients">要设定的客户端对象集合</param>
        public static void StartSendBmp(List<ClientObject>Clients)
        {
            foreach(ClientObject client in Clients)
            {
                client.IsPausedSendImg = false;
            }
        }

        /// <summary>
        /// 设定所有指定客户端的图片发送频率
        /// </summary>
        /// <param name="Clients">要设定的客户端列表</param>
        /// <param name="Rate">要设定的频率</param>
        public static void SetSendImgRate(int Rate,List<ClientObject>Clients)
        {
            foreach (ClientObject client in Clients)
            {
                client.SendImgRate = Rate;
            }
        }

        /// <summary>
        /// 刷新客户端图像
        /// </summary>
        /// <param name="Clients">要刷新图像的客户端列表</param>
        public static void RefreshImage(List<ClientObject>Clients)
        {
            foreach (ClientObject client in Clients)
            {
                client.RefreshBitMap();
            }
        }

        /// <summary>
        /// 设定图片大小
        /// </summary>
        /// <param name="Clients">要设定的客户端列表</param>
        public static void SetImgSize(Size Size , List<ClientObject>Clients)
        {
            foreach (ClientObject client in Clients)
            {
                client.SendImgSize = Size;
            }
        }

        /// <summary>
        /// 设定发送图片的格式
        /// </summary>
        /// <param name="FormatString">格式文本</param>
        /// <param name="Clients">客户端列表</param>
        public static void SetImgFormat(string FormatString,List<ClientObject>Clients)
        {
            foreach (ClientObject client in Clients)
            {
                client.SendImgFormat = FormatString;
            }
        }

        /// <summary>
        /// 向指定客户端发送Ping请求
        /// </summary>
        /// <param name="Clients">要发送请求的客户端列表</param>
        public static void Ping(List<ClientObject>Clients)
        {
            foreach (ClientObject client in Clients)
            {
                client.Ping();
            }
        }

    }
}
